package com.ds.infrastructure.hyperspace.console.model.request.operator;

import com.ds.infrastructure.hyperspace.console.entity.enums.TbPublicEnum;
import com.ds.infrastructure.hyperspace.console.entity.table.TbOperator;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: yaozhendong
 * @create: 2019-09-25 17:56
 **/
@Data
@NoArgsConstructor
public class SaveOperatorForm {
    private String operatorName;

    private Integer operatorType;

    private String operatorParams;

    private String description;

    public static TbOperator toEntity(SaveOperatorForm form) {
        TbOperator tbOperator = new TbOperator();
        tbOperator.setOperatorName(form.getOperatorName());
        tbOperator.setOperatorType(form.getOperatorType());
        tbOperator.setOperatorParams(form.getOperatorParams());
        tbOperator.setDescription(form.description);
        tbOperator.setGmtIsDeleted(TbPublicEnum.GMD_IS_DEL.NO.code);
        return tbOperator;
    }

    public static TbOperator toEntity4SelectOne(SaveOperatorForm form) {
        TbOperator tbOperator = new TbOperator();
        tbOperator.setOperatorName(form.getOperatorName());
        tbOperator.setOperatorType(form.getOperatorType());
        tbOperator.setGmtIsDeleted(TbPublicEnum.GMD_IS_DEL.NO.code);
        return tbOperator;
    }
}
